Skip to main content

All Questions

Tagged with
0votes
1answer
332views

Shell script not picking up variable in if statement

I have some code that looks like this: ################### - Let's call this section 1 if [ -n "$STUFF_JAVA" ]; then __LAUNCHER="$STUFF_JAVA" else __LAUNCHER="...
Chicken Sandwich No Pickles's user avatar
0votes
0answers
23views

My variable seems to change when passed into a CLI [duplicate]

I am attempting to use a java based program, CRFVoter, for text mining. I called and executed the script as specified. [user]$ java -jar CRFVoter.jar usage: CRFVoter GPRO Command Line Tool for ...
Alex Plastow's user avatar
1vote
2answers
10kviews

-bash:: /bin/bash: bad interpreter: Operation not permitted

I recently replaced adoptopenjdk-13 with adoptopenjdk-16. I have a script file that uses the tool by name, so I changed it from 13 to 16. Its new contents: #!/bin/bash if [ -z ${JAVA_OPTS+x} ] then ...
Greg Dougherty's user avatar
-1votes
2answers
730views

How to get all the contents of df -h command as string

I want to have a CRON job which calls a Java program to send a mail if disk space is more than 80%. Along with it, I want to send the contents of the df -h command also. What I did was create a ...
HegdeS's user avatar
2votes
1answer
1kviews

Why are environment variables not resolved when double-clicking .desktop file?

I have a Java application which is launched by a shell script. The first part of the shell script is to resolve the Java location by looking at $JAVA_HOME. The shell script is working well if launched ...
akasolace's user avatar
6votes
2answers
14kviews

setting JAVA_HOME and PATH with update-alternatives

EDITED The question was more about bash script them java environment and thanks for those whom had the patience and spare the time to reply me. I am much obliged. As for the Java environment I started ...
RicardoPHP's user avatar
1vote
1answer
91views

When would [[ ]] test fail and [ ] succeeds for the same test?

I came across a script that has the line: java_version=$($JAVA_HOME/bin/java -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d '_' -f 1,3) followed by the test: if [[ -n "$...
joker's user avatar
0votes
1answer
46views

Script Integer getting prefixed with "

I am running a jar file using a very basic shell script (I literally just need this to run on startup of a NAS). However, I am getting some rather unexpected behavior: Script looks like this: java -...
Nico-Ben de Villiers's user avatar
0votes
1answer
750views

bash file contain executable/binary code

I found this tool and when I downloaded it is a bash executable that contains binary code. First of all I didn't know this is possible. Does anyone know who this can be done? Also I am not sure how ...
Jim's user avatar
  • 1,459
0votes
1answer
708views

I can check output of a command in shell script but I cannot do the same in crontab

I can run my script as .sh file in ubuntu shell but it does not work when it is called from cron job.I run my script into an ubuntu container (using docker) as if [ `java -jar /path/to/my.jar |grep -...
foad322's user avatar
0votes
1answer
793views

Linux start screen and run a java program and detach it?

I have the following script that should do the following: Stop screen "server" if exists Start screen "server" Run a java program and detach screen. However, when I firstly run the script, the program ...
Ben Berizovsky's user avatar
1vote
1answer
2kviews

How to check java version on multiple servers? [duplicate]

I have 100 servers and i need to login to them with ssh from central server using script: i tried below with this i should get the version redirected to the file which will be stored at central server....
Santosh Garole's user avatar
0votes
1answer
62views

linux + compare between two folders

under /usr/lib/ambari-metrics-get folder and /usr/lib/ambari-metrics-put we have jar files /usr/lib/ambari-metrics-get/stax-api-1.0.1.jar /usr/lib/ambari-metrics-get/stringtemplate-3.2.1.jar /usr/...
yael's user avatar
  • 13.9k
0votes
1answer
1kviews

Pass array to Java from Shell Script

I have data as below which I want to pass directly to Java main method from shell script at once. 1 firstfile.txt Success 2 secondfile.txt Failed 3 thirdfile.txt Success I know I can call ...
826dna's user avatar
1vote
1answer
691views

how to find the higher java version on linux machine with bash or shell script

we need to test and compare java versions any suggestion for tricky way how to verify if $version > $New_version ? [root@master tmp]# version=$(java -version 2>&1 | awk -F '"' '/version/ {...
yael's user avatar
  • 13.9k

153050per page
close